package com.haven123.cloudapp.config.server.enc;

import lombok.extern.slf4j.Slf4j;
import org.jasypt.encryption.StringEncryptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Slf4j
@Component
public class JasyptUtil {
    @Autowired private StringEncryptor encryptor;

    public String encrypt(String str){
        String encrypt = encryptor.encrypt(str);
        log.info(encrypt);
        return encrypt;
    }
    public String decrypt(String str){
        String decrypt = encryptor.decrypt(str);
        log.info(decrypt);
        return decrypt;
    }
}
